//测试全局变量
//alert(thisUser.name);
$("#workSpace").addClass("active-menu");

function logout(){
	request = new Object();
	request.operation = "logout";
	request.jsonObject = new Object();
	request.jsonObject.na = "na";
	$.post("Gate", {
		req : JSON.stringify(request)
	}, function(data, status) {
		if (status == "success") {
			var resp = eval("(" + data + ')');
			if(resp.status==0)
			self.location = "login.html";
			//var resp = eval("(" + data + ')');
			}
		else {
			alert("HTTP请求异常，请再次提交！");
		}
	});
}

// 左侧导航栏的点击事件
$('a').click(function(e) {
	switch ($(this).attr('id')) {
	case "workSpace":
		$("div a").removeClass("active-menu");
		$("#workSpace").addClass("active-menu");
		$("#page-wrapper").load("parts/workSpace.html");
		break;
	case "myTask":
		$("div a").removeClass("active-menu");
		$("#myTask").addClass("active-menu");
		break;
	case "undoTask":
	    $("div a").removeClass("active-menu");
		$("#undoTask").addClass("active-menu");
		taskType="u";
		$("#page-wrapper").load("parts/parts.tasklist.html");
		break;
	case "hisTask":
		$("div a").removeClass("active-menu");
		$("#hisTask").addClass("active-menu");
		taskType="h";
		$("#page-wrapper").load("parts/parts.tasklist.html");
		break;
	case "readTask":
		$("div a").removeClass("active-menu");
		$("#readTask").addClass("active-menu");
		taskType="r";
		$("#page-wrapper").load("parts/parts.tasklist.html");
		break;
	case "votes":
		$("div a").removeClass("active-menu");
		$("#votes").addClass("active-menu");
		// $("#page-wrapper").load("passwdEdit.html");
		break;

	case "voteManage":
		$("div a").removeClass("active-menu");
		$("#voteManage").addClass("active-menu");
		$("#page-wrapper").load("parts/voteManage.html");
		break;

	case "myVote":
		$("div a").removeClass("active-menu");
		$("#myVote").addClass("active-menu");
		$("#page-wrapper").load("parts/voteManageMyVote.html");
		break;
	case "contacts":
		$("div a").removeClass("active-menu");
		$("#contacts").addClass("active-menu");
		$("#page-wrapper").load("parts/contacts.html");
		break;
	case "myConf":
		$("div a").removeClass("active-menu");
		$("#myConf").addClass("active-menu");
		// $("#page-wrapper").load("parts/passwdEdit.html");
		break;
	case "userEdit":
	$("div a").removeClass("active-menu");
		$("#userEdit").addClass("active-menu");
		$("#page-wrapper").load("parts/userEdit.html");
		break;
	case "passwdEdit":
		$("div a").removeClass("active-menu");
		$("#passwdEdit").addClass("active-menu");
		$("#page-wrapper").load("parts/passwdEdit.html");
		break;
	case "teamManage":
		$("div a").removeClass("active-menu");
		$("#teamManage").addClass("active-menu");
		$("#page-wrapper").load("parts/teamManage.html");
		break;
	case "userManage":
		$("div a").removeClass("active-menu");
		$("#userManage").addClass("active-menu");
		$("#page-wrapper").load("parts/userManage.html");
		break;
	}
});
